/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package bRM_LL73.impl;

import genArchi.impl.NodeImpl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import utils.UtilsModelInstance;
import zFactory.NodeLiu73a02;
import zFactory.NodeSrl90a03;
import bRM_LL73.BRM_LL73;
import bRM_LL73.BRM_LL73Package;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>BRM LL73</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link bRM_LL73.impl.BRM_LL73Impl#getValue <em>Value</em>}</li>
 *   <li>{@link bRM_LL73.impl.BRM_LL73Impl#getNb_Tasks <em>Nb Tasks</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class BRM_LL73Impl extends NodeImpl implements BRM_LL73 {
	/**
	 * The default value of the '{@link #getValue() <em>Value</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getValue()
	 * @generated
	 * @ordered
	 */
	protected static final double VALUE_EDEFAULT = 0.0;

	/**
	 * The cached value of the '{@link #getValue() <em>Value</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getValue()
	 * @generated
	 * @ordered
	 */
	protected double value = VALUE_EDEFAULT;

	/**
	 * The default value of the '{@link #getNb_Tasks() <em>Nb Tasks</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNb_Tasks()
	 * @generated
	 * @ordered
	 */
	protected static final int NB_TASKS_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getNb_Tasks() <em>Nb Tasks</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNb_Tasks()
	 * @generated
	 * @ordered
	 */
	protected int nb_Tasks = NB_TASKS_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected BRM_LL73Impl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return BRM_LL73Package.Literals.BRM_LL73;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public double getValue() {
		return value;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setValue(double newValue) {
		double oldValue = value;
		value = newValue;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, BRM_LL73Package.BRM_LL73__VALUE, oldValue, value));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getNb_Tasks() {
		return nb_Tasks;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setNb_Tasks(int newNb_Tasks) {
		int oldNb_Tasks = nb_Tasks;
		nb_Tasks = newNb_Tasks;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, BRM_LL73Package.BRM_LL73__NB_TASKS, oldNb_Tasks, nb_Tasks));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case BRM_LL73Package.BRM_LL73__VALUE:
				return new Double(getValue());
			case BRM_LL73Package.BRM_LL73__NB_TASKS:
				return new Integer(getNb_Tasks());
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case BRM_LL73Package.BRM_LL73__VALUE:
				setValue(((Double)newValue).doubleValue());
				return;
			case BRM_LL73Package.BRM_LL73__NB_TASKS:
				setNb_Tasks(((Integer)newValue).intValue());
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case BRM_LL73Package.BRM_LL73__VALUE:
				setValue(VALUE_EDEFAULT);
				return;
			case BRM_LL73Package.BRM_LL73__NB_TASKS:
				setNb_Tasks(NB_TASKS_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case BRM_LL73Package.BRM_LL73__VALUE:
				return value != VALUE_EDEFAULT;
			case BRM_LL73Package.BRM_LL73__NB_TASKS:
				return nb_Tasks != NB_TASKS_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (value: ");
		result.append(value);
		result.append(", nb_Tasks: ");
		result.append(nb_Tasks);
		result.append(')');
		return result.toString();
	}
	
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public void compute() 
	{
		if (!done)
		{
		/* Compute the bound*/
		this.value = this.nb_Tasks * (Math.pow(2, 1.0/this.nb_Tasks) - 1);
		this.done = true;
		}

		/* Complete the liu & Layland method, if it exists*/
		UtilsModelInstance.setNode(this, new NodeLiu73a02(null, this, false));
		
		/* Complete the Sha method , if it exists*/
		UtilsModelInstance.setNode(this, new NodeSrl90a03(null, this, null, false));
		
	}

} //BRM_LL73Impl
